var app = getApp(), Toast = require("../../libs/zanui/toast/toast");

Page({
    data: {},
    onLoad: function() {
        var t = this;
        app.viewCount(), wx.getStorageSync("userInfo") ? t.getMyInfo() : t.setData({
            showLogin: !0
        }), t.setData({
            version: app.data.version
        }), app.util.footer(t);
    },
    getUserInfo: function(t) {
        var a = this;
        "getUserInfo:ok" == t.detail.errMsg ? (a.setData({
            showLogin: !1
        }), app.util.getUserInfo(function() {
            a.getMyInfo();
        }, t.detail)) : wx.navigateTo({
            url: "../home/index"
        });
    },
    closeModal: function() {
        this.setData({
            showLogin: !1
        }), wx.navigateTo({
            url: "../home/index"
        });
    },
    getMyInfo: function() {
        var a = this;
        app.util.request({
            url: "entry/wxapp/my",
            cachetime: "0",
            data: {
                m: "superman_hand2"
            },
            success: function(t) {
                t.data.errno ? a.showIconToast(t.errmsg) : a.setData({
                    my: t.data.data
                });
            }
        });
    },
    showIconToast: function(t) {
        var a = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : "fail";
        Toast({
            type: a,
            message: t,
            selector: "#zan-toast"
        });
    },
    linktoWxapp: function(t) {
        var a = t.currentTarget.dataset.appid, e = t.currentTarget.dataset.path;
        wx.navigateToMiniProgram({
            appId: a,
            path: e,
            success: function(t) {
                console.log("打开成功");
            }
        });
    }
});